home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Treccani Italiana Di Scienze Lettere Ed Arti
/
[Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso
/
pc
/
data
/
xxi_appendice_dvd.swf
/
scripts
/
__Packages
/
mx
/
utils
/
ObjectCopy.as
< prev
Wrap
Text File
|
2007-11-08
|
2KB
|
60 lines
class mx.utils.ObjectCopy
{
function ObjectCopy()
{
}
static function copy(refObj)
{
var _loc1_ = new Function(refObj.__proto__.constructor)();
mx.utils.ObjectCopy.copyProperties(_loc1_,refObj);
return _loc1_;
}
static function copyProperties(dstObj, srcObj)
{
var _loc2_ = srcObj;
var to;
for(var i in _loc2_)
{
to = typeof _loc2_[i];
if(to != "function")
{
if(to == "object")
{
if(_loc2_[i] instanceof Array)
{
var p = new Array();
var _loc3_ = _loc2_[i];
var _loc1_ = 0;
while(_loc1_ < _loc3_.length)
{
p[_loc1_] = _loc3_[_loc1_];
_loc1_ = _loc1_ + 1;
}
dstObj[i] = p;
}
else if(_loc2_[i] instanceof String)
{
dstObj[i] = new String(_loc2_[i]);
}
else if(_loc2_[i] instanceof Number)
{
dstObj[i] = new Number(_loc2_[i]);
}
else if(_loc2_[i] instanceof Boolean)
{
dstObj[i] = new Boolean(_loc2_[i]);
}
else
{
dstObj[i] = mx.utils.ObjectCopy.copy(_loc2_[i]);
}
}
else
{
dstObj[i] = _loc2_[i];
}
}
}
}
}